<template>
	<!-- zhuce -->
	<view>
		<button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
			<image class="avatar" :src="avatarUrl"></image>
		</button>
		<input type="nickname" class="weui-input" placeholder="请输入昵称" />
		<button class="register" type="primary" @click="register">绑定</button>
	</view>
</template>

<script>
import func from '@/utils/funlogin.js';
import { getBindWx } from '@/api/me.js';
export default {
	data() {
		return {
			avatarUrl: ','
		};
	},
	methods: {
		onChooseAvatar(e) {
			console.log(e.detail);
			const { avatarUrl } = e.detail;
			this.avatarUrl = avatarUrl;
			//TODO 上传图片  &保存表单信息
		},
		async register() {
			//注册
			//校验
			// func.wechatAppLogin()
		}
	}
};
</script>

<style lang="scss" scoped>
.avatar-wrapper {
	width: 100upx;
	height: 100upx;
	border-radius: 50%;
	padding: 0;
	margin-top: 100upx;
	image {
		width: 100upx;
		height: 100upx;
		object-fit: fill;
	}
}
.weui-input {
	margin-left: 40upx;
	margin-top: 20upx;
}
.register {
	position: absolute;
	bottom: 20upx;
	width: 100%;
}
</style>
